<?php

// +----------------------------------------------------------------------
// | 功能说明"
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2030 http://www.jmzh1688.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: lxl
// +----------------------------------------------------------------------


namespace app\admin\controller;

use think\Controller;
use think\Db;

use app\admin\model\SysMenuModel;


class Index extends Base
{


    public function board()
    {
        return $this->fetch();
    }

    /**
     * 框架页面
     * @return mixed
     */
    public function index()
    {

        $menmodule=new SysMenuModel();

        $menulist=doListLeftMenu($menmodule->getListbyRoleId(session('roleid')));
        $this->assign([
            'menulist' => $menulist
        ]);

        return $this->fetch('/index');
    }

    /**
     * 首页
     * @return mixed|\think\response\Json
     */
    public function indexPage()
    {
        return $this->fetch('index/index');
    }

    /**
     * 清除缓存
     */
    public function clear() {
        if (delete_dir_file(CACHE_PATH) && delete_dir_file(TEMP_PATH)) {
            writelog('清除缓存成功',200);
            return json(['code' => 200, 'msg' => '清除缓存成功']);
        } else {
            writelog('清除缓存失败',100);
            return json(['code' => 100, 'msg' => '清除缓存失败']);
        }
    }
}
